<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>确认订单-${setting.name}</title>
    [#include "common/include.ftl"]
    <link rel="styleSheet" href="${base}/resource/css/cart.css">
    <link type="text/css" rel="styleSheet" href="${base}/resource/css/member.css">
	<link type="text/css" rel="styleSheet" href="${base}/resource/css/member-module.css">
	<script type="text/javascript" src="${base}/resource/js/address.module.js"></script>
	<script type="text/javascript" src="${base}/resource/plug/citySelect/jquery.cityselect.js"></script>
    [#--<script type="text/javascript" src="${base}/resource/js/confirm.js"></script>--]
</head>
<body class="customer">
<div class="top w1">
	[#include "/common/header-top.ftl"/]
	<div class="top-search w">
		<div id="header-logo">
			<a href="${base}/index.jhtml">
				<img src="[@Pic pic=setting.logo/]" height="60" width="200">
			</a>
		</div>
		<div id="cart-step">
			<div class="step step2"></div>
		</div>
		<div class="clear"></div>
	</div>
</div>
<div id="P_confirm">
    <div id="P_main">
        <form id="createOrderForm" action="${base}/intergral/create.jhtml" method="post">
            <input type="hidden" name="token" value="${token}"/>
            [#--<input type="hidden" name="weight" value="${info.weight}"/>--]
            <div class="mt">
                <h2>填写并核对订单信息</h2>
            </div>
            <div class="step-title">
                <h3>收货人信息</h3><a class="add-new-address" href="javascript:">新增收货地址</a>
            </div>
            <div class="step-cont">
                <input type="hidden" name="receiverId">
                <div class="address-list">
                    <div class="mc">
                        <div class="form">
                            <input type="hidden" value="0" class="id">
                            <div class="item">
                                <div class="label">
                                    <em>*</em><span>收货人</span>
                                </div>
                                <div class="fl">
                                    <input type="text" name="name" class="text name">
                                    <span class="error-msg"></span>
                                </div>
                                <div class="clear"></div>
                            </div>

                            <div class="item">
                                <div class="label">
                                    <em>*</em><span>手机号码</span>
                                </div>
                                <div class="fl">
                                    <input type="text" name="phone" class="text phone">
                                    <span class="error-msg"> </span>
                                </div>
                                <div class="clear"></div>
                            </div>

                            <div class="item">
                                <div class="label">
                                    <em>*</em><span>详细地址</span>
                                </div>
                                <div class="fl">
                                    <input type="text" name="address" class="text text1 address">
                                    <span class="error-msg"></span>
                                </div>
                                <div class="clear"></div>
                            </div>
                            <div class="item">
                                <div class="label">
                                    <em>*</em><span>配送门店</span>
                                </div>
                                <div class="fl">
                                    <select id="sel_store_city_md">
                                        <option value ="${(curr_store.cityId)!''}">${(curr_store.cityName)!''}</option>
                                    [#list citys as city]
                                        [#if curr_store.cityId != city.id]
                                            <option value ="${(city.id)!''}">${(city.name)!''}</option>
                                        [/#if]
                                    [/#list]


                                    </select>
                                    <select id="sel_store_md" name="store">
                                        <option value ="${(curr_store.id)!''}">${(curr_store.name)!''}</option>
                                    [#if curr_store?? && curr_store.others?size > 0]
                                        [#list curr_store.others as store]
                                            [#if store.id != curr_store.id]
                                                <option value ="${(store.id)!''}">${(store.name)!''}</option>
                                            [/#if]
                                        [/#list]
                                    [/#if]
                                    </select>
                                </div>
                                <div class="clear"></div>
                            </div>

                        </div>
                    </div>

                </div>
            </div>
            <div class="step-title">
                <h3>送货清单</h3><a href="javascript:history.back();">返回购物车</a>
            </div>
            <div class="step-cont">
                <div class="shopping-list">
                    <table>
                        <tr>
                            <th width="100">&nbsp;</th>
                            <th width="500">商品名称</th>
                            <th width="100">积分</th>
                            <th>数量</th>
                            <th>合计</th>
                        </tr>
                    [#assign total=0/]
                    [#if itemList?has_content]
                        [#list itemList as item]
                        [#assign total = total + item.subtotal/]
                        <tr>
                            <td class="p-img">
                                <a href="${base}/intergral/content/${item.goodsId}.jhtml" title="${item.productName}" target="_blank"><img class="lazy" data-original="[@Pic pic=item.image postfix="100x100" /]" postfix="100x100" width="100" height="100"></a>
                            </td>
                            <td class="p-name"><a href="${base}/intergral/content/${item.goodsId}.jhtml" target="_blank">${item.productName}</a></td>
                            <td class="price">${item.price}</td>
                            <td>${item.quantity}</td>
                            <td>${item.subtotal}</td>
                        </tr>
                        [/#list]
                    [#elseif goods??]
                    	[#assign total = goods.price*quantity/]
                        <tr>
                            <td class="p-img">
                                <a href="${base}/intergral/content/${item.goodsId}.jhtml" title="${goods.name}" target="_blank"><img class="lazy" data-original="[@Pic pic=goods.image_default postfix="100x100" /]" postfix="100x100" width="100" height="100"></a>
                            </td>
                            <td class="p-name"><a href="${goods.path}" target="_blank">${goods.name}</a></td>
                            <td class="price">${goods.price}</td>
                            <td>${quantity}</td>
                            <td></td>
                        </tr>
                    [#else]

                    [/#if]
                    </table>
                </div>
            </div>
            <div class="step-cont mt20">
                <div class="statis-list fr">
                    <div class="list"><span><i>[#if itemList?has_content]${itemList?size}[#elseif goods??]1[/#if]</i>件商品，需消耗积分：</span><em>${total}</em></div>
                </div>
                <div class="clear"></div>
            </div>
            <div id="F-b-btn" class="step-tit pay-action"><a class="hp-button">提交订单</a>

                <p><span class="text">提交订单消耗积分：</span><strong class="total-amount">${total}</strong></p>

                <div class="clear"></div>
            </div>
        </form>

        <script>
            $(function(){

               // var list = '${curr_store.others}';

                $("#sel_store_city_md").change(function(){
                    $.get( base+"/city/storesjson.jhtml",{"cityId":$(this).val()},function(data){
                        $("#sel_store_md").empty();

                        for(i=0;i<data.stores.length;i++){
                            $("#sel_store_md").append("<option value ='"+data.stores[i].id+"'>"+data.stores[i].name+"</option>");
                        }


                        // $.cookie('curr_store', data, { expires: 7 });
                        //location.href = base + "/index.jhtml";
                    });
                });

                $(".pay-action>.hp-button").click(function(){
                    ajax({
                        url : $('#createOrderForm').attr('action'),
                        async : false,
                        data : $('#createOrderForm').serializeArray(),
                        showError : true,
                        success : function(data) {
                            if (data.type == 'success') {
                                alert("购买成功！");
                                location.href= base + "/member/index.jhtml";
                            }
                        },
                        complete : function() {

                        }
                    });
                });;
            });
        </script>
        </div>
    </div>
</div>
[#include "common/footer-slidebar-lazyload.ftl"]
<!-- 新增收货地址-->
<div id="edit-cont">

</div>


<script type="text/javascript">
	var total = "${total}";
</script>



</body>
</html>